#all:
#	g++ -pthread -g -o MoteCollection *.cpp


	
	
CC=g++
CFLAGS= -pthread -g
Application = EventsTest.cpp
Output = SimpleDemo

DIR_SERIAL_OBJS= ./serial/basecomm.o ./serial/serialcomm.o ./serial/sfpacket.o ./serial/packetbuffer.o
SERIAL_OBJS= basecomm.o serialcomm.o sfpacket.o packetbuffer.o

all: MoteCollection

MoteCollection: $(DIR_SERIAL_OBJS) MoteCollection.o MoteBridge.o NetworkPacket.o Mote.o EventManager.o 
	$(CC) $(CFLAGS) $(SERIAL_OBJS) $(Application) MoteCollection.o MoteBridge.o NetworkPacket.o Mote.o EventManager.o -o $(Output)

EventManager.o: EventManager.cpp EventManager.h

MoteCollection.o: MoteCollection.cpp MoteCollection.h Mote.h MoteBridge.h

MoteBridge.o: MoteBridge.cpp MoteBridge.h MoteCollection.h Mote.h NetworkPacket.h ./serial/serialcomm.h ./serial/sfpacket.h

NetworkPacket.o: NetworkPacket.cpp NetworkPacket.h

Mote.o: Mote.cpp Mote.h

TestApp.o: TestApp.cpp Mote.h MoteCollection.h
	


sf: sf.o sfcontrol.o serialcomm.o tcpcomm.o basecomm.o packetbuffer.o sfpacket.o
	$(CC) $(CFLAGS) sf.o sfcontrol.o serialcomm.o tcpcomm.o basecomm.o packetbuffer.o sfpacket.o -o sf

%.o: %.cpp
	$(CC) -c $(CFLAGS) $<

sf.o: ./serial/sf.cpp ./serial/sfcontrol.h ./serial/tcpcomm.h ./serial/serialcomm.h ./serial/packetbuffer.h


serialcomm.o: ./serial/serialcomm.cpp ./serial/serialcomm.h ./serial/basecomm.h ./serial/sfpacket.h ./serial/packetbuffer.h ./serial/sharedinfo.h

tcpcomm.o: ./serial/tcpcomm.cpp ./serial/sharedinfo.h ./serial/tcpcomm.h ./serial/sfpacket.h ./serial/packetbuffer.h ./serial/basecomm.h

sfpacket.o: ./serial/sfpacket.cpp ./serial/sfpacket.h ./serial/serialprotocol.h

basecomm.o: ./serial/basecomm.cpp ./serial/basecomm.h 

sfcontrol.o: ./serial/sfcontrol.cpp ./serial/sfcontrol.h ./serial/sharedinfo.h ./serial/packetbuffer.h ./serial/tcpcomm.h ./serial/serialcomm.h

packetbuffer.o: ./serial/packetbuffer.cpp ./serial/packetbuffer.h ./serial/sfpacket.h

clean:
	rm -rf *.o SimpleDemo

	